
var myRss = (function (jQ,window) {
    var sMode;
    var oSthDraged;
    var sUserSet = "UserSetting";
    var $userList = jQ("#userList"),
        $popfeedList = jQ("#popfeedList"),
        $recomendList = jQ("#recomendList"),
        $userTitle = jQ("#userTitle"),
        $popfeedTitle = jQ("#popfeedTitle"),
        $recomendTitle = jQ("#recomendTitle");

    var init = function (sInitMode) {
        sMode = sInitMode || "";
        jQ(document).ready(function () {
            if (sMode == "Flash") {
                fFlashRequestInitialize("flashRequest.swf?" + new Date().valueOf());
            }
            getRss.fShowRssHead();
            $userTitle.click(function () {
                getRss.fUpdateList("local", $userList);
            });
            $popfeedTitle.click(function () {

                getRss.fUpdateList("hot", $popfeedList);
            });
            $recomendTitle.click(function () {
                getRss.fUpdateList("recommend", $recomendList);
            });
            jQ("#test").click(function () {
                window.open("tetris/t.html");

            });
            jQ("#bSubmit").click(function () {
                var sLink = jQ("input[name='inLink']").val();
                var sTitle;
                sTitle = getRss.fAddFeed(sLink, "utf-8");
            });
            jQ("#bClear").click(function () {
                if (confirm("确定删除所有？\nTips：可以把不要feed拖动到垃圾箱。")) {
                    LocalData.remove("commandAll");
                    getRss.fUpdateList("local", jQ("#userTitle"));

                }
            });
            $userTitle.mouseover(function () {
                jQ("#bClear").removeClass("iHide").addClass("iShowInline");
            });
            $userTitle.mouseout(function () {
                jQ("#bClear").removeClass("iShowInline").addClass("iHide");
                //var tmp11 = jQ("#userTitle + ul > li").text();
                //alert(tmp11);
            });
            jQ("input").focus(function () {
                if (this.value == "在此添加feed.." || this.value == "自定title") {
                    this.value = "";
                }
            });
            var oJQdvLeftMenu = jQ("#dvLeftMenu");
            $(document).on("click",".panel-collapse>ul>li",function(){
                if (oJQdvLeftMenu.hasClass("in")) {
                    oJQdvLeftMenu.removeClass("in").addClass("collapse");
                }
            });
            $("#setterComf").click(function(){
                var oInfo = getSetter("modalSetter");
                saveSetting(oInfo);
            });
            $(".navButSet").click(function(){
                //LocalData.get(key)//提取本地储存的设置
                //fUpdateSetting()  //更新到html的选项中

            });
        });
    };//init
    var EventTrigger = {
        TitleEffect: function () {
            var $li = jQ("#userList > ul > li");
            var $span = jQ("#userList > ul > li > span");
            $li.mouseenter(function () {
                $(this).find("span").fadeTo("fast", 0.2);
            });
            $li.mouseleave(function () {
                $(this).find("span").fadeOut("fast");
            });
            $span.mouseenter(function () {
                $(this).fadeTo("fast", 1);
            });
            $span.mouseleave(function () {
                $(this).fadeTo("fast", 0.2);
            });
            $span.click(function () {
                var jqOParent = jQ(this).parent();
                var jqONeedDel = jqOParent.find("a").attr("id");
                if (confirm("确定删除此feed？")) {
                    LocalData.remove(jqONeedDel);
                    jqOParent.hide();
                };
            });
        }
    };
    function getSetter(idTarget){	//此用转换json格式将字符串转为对象，但其实可以用obj[key]直接定义对象。
        var oInfo = {},
            aInfo = [],
            sInfo = "";
        
        var aojQSel = $("#" + idTarget).find("select");
        $.each(aojQSel, function (i, oSelect) {
            var ojQselect = $(oSelect);
            var sSelect = ojQselect.attr("id");
            var sOpinion = ojQselect.val();
            aInfo.push('\"'+sSelect+'\":\"'+sOpinion+'\",');
        });
        sInfo = "{" + aInfo.join("") + "}";
        sInfo = sInfo.replace(",}","}");
        oInfo = JSON.parse(sInfo);
        return oInfo;
    }
    function saveSetting(oInfo){
        var oOpinion = $.extend({
                MaxCount:20,
                ShowDesc:120,
                showFormat:false,
                showImg:true,
                ShowPubDate:false,
                ShowHead:true,
                setLayout:true
            },oInfo);
        LocalData.addData(sUserSet,oOpinion);
    }
    
    var LocalData = {
        add: function (sLink, sName) {

            var sLocStor = this.getTimeName() + sLink.match("...$");
            var oInfo = {
                sStorageName: sLocStor,
                sLink: sLink,
                sName: sName
            };
            this.addData(sLocStor, oInfo);
        },
        addData:function(sLocStor,oInfo){
            var sInfo = JSON.stringify(oInfo);
            localStorage.setItem(sLocStor, sInfo);

        },
        get: function (sKey) {
            var i,
                aoInfo = [];
            if(sKey!=undefined){
                aoInfo[0] = JSON.parse(localStorage.getItem(sKey));
                return aoInfo[0];
            }
            var sKey,
                iLength = localStorage.length;
            for (i = 0; i < iLength; i++) { //for(i in localStorage)
                   sKey = localStorage.key(i);
                if(sKey == sUserSet){
                    continue;
                }
                try{
                     aoInfo[i] = JSON.parse(localStorage.getItem(sKey));
                }catch(e){      //nginx会出现“无效字符错误”
                    break;
                }        
            }
            return aoInfo;

        },
        remove: function (sKey) {
            if (sKey == "commandAll") {
                localStorage.clear();
            } else {
                localStorage.removeItem(sKey);
            }
        },
        getTimeName: function () {
            var sTime = Date().toString()
            sTime = sTime.replace(/\s/g, "").replace(/:/g, "").slice(0, 13);
            return sTime;
        },
        UIdrag: function (obj) {
            jQ("#dustbin").removeClass("iHide");
            jQ("#dustbin").addClass("iShowInline");
            oSthDraged = obj;
        },
        UIdrop: function (ev) {
            ev.preventDefault();
            jQ(oSthDraged).parent().addClass("iHide");
            var sLocStorage = jQ(oSthDraged).attr("id");
            this.remove(sLocStorage);
        },
        UIallowDrop: function (ev) {
            ev.preventDefault();
        },
        UIdragEnd: function (ev) {
            jQ("#dustbin").removeClass("iShowInline");
            jQ("#dustbin").addClass("iHide");
        }
    };//LocalData


    var getRss = {

        fAddFeed: function (sLink, encoding) {
            var that = this;
            that.fGet(sLink, encoding, function (sTitle) {
                if (sTitle == undefined) {
                    sTitle = jQ("input[name='inTitle']").val() || "title";
                }
                LocalData.add(sLink, sTitle);
                that.fUpdateList("local", $userList, true);
                //interface effect:
                $userList.collapse('show');
                $(".panel-collapse.in").collapse('hide');
            });
        },
        fShowRssLocal: function (oInsertedPosition) {
            var i;
            var sLink, sName;
            var aHtml = [];
            var sHtml = "";
            var aoInfo = LocalData.get();
            aHtml.push('<ul class="nav">');
            for (i = 0; i < aoInfo.length; i++) {
                try{
                    sStorageName = aoInfo[i].sStorageName;  //i=0时有时会出现undefined
                }catch(e){
                    continue;
                }
                sLink = aoInfo[i].sLink;
                sName = aoInfo[i].sName;
                aHtml.push('<li><span class="glyphicon glyphicon-remove itemIcon" unselectable="on"></span><a href="#" id="' + sStorageName + '" draggable="true" ondragstart="myRss.UIdrag(this)"  ondragend="myRss.UIdragEnd(event)"  onclick="myRss.getFeed(' + "'" + sLink + "'" + ');return false;">' + sName + '</a></li>');
            }
            aHtml.push('</ul>');
            sHtml = aHtml.join("");
            oInsertedPosition.append(sHtml);
            //interface effect:
            EventTrigger.TitleEffect();

        },
        fShowRssHead: function () {
            if (LocalData.get().length == 0) {
                this.fShowRss4("recommend", $recomendList);//深耦合
                //interface effect:
                $userTitle.removeClass('in');
                $recomendList.collapse('show');
            } else {
                this.fShowRssLocal($userList);//show default
            }
        },
        fUpdateList: function (sUserName, oSelect, bForce) {
            var iLength = oSelect.html().trim();
            if(iLength.length == 0){
                this.fShowRss4(sUserName, oSelect);
            }else if(bForce){
                oSelect.empty();
                this.fShowRss4(sUserName, oSelect);
                //interface effect:
                //未点击面板的情况下强制执行显示
                $(".panel-collapse.in").collapse('hide');
                oSelect.collapse('show');
            }
        },
        fShowRss4: function (sUserName, oInsertedPosition) {
            var oUser, oFeeds, oFeedLink, oFeedName;
            var aHtml = [];
            var sHtml = "";
            if (sUserName === "local") {
                this.fShowRssLocal(oInsertedPosition);
                return;
            }
            jQ.ajax({
                url: 'xml/rrs_catalog.xml',
                type: 'Get',
                charset: 'utf-8',
                dataType: 'xml',
                timeout: 2000,
                error: function (xml) {
                    alert('Error loading XML document.' +xml.status +":"+ xml.statusText);
                },
                success: function (xml) {
                    aHtml.push('<ul class="nav">');
                    jQ(xml).find("USER").each(function (i) {
                        oUser = jQ(this);
                        if (oUser[0].getAttribute("id") == sUserName) {
                            oFeeds = oUser[0].getElementsByTagName("FEED");
                            for (var i = 0; i < oFeeds.length; i++) {
                                try {
                                    oFeedLink = oFeeds[i].getElementsByTagName("LINK");
                                    oFeedName = oFeeds[i].getElementsByTagName("NAME");
                                    var sLink = oFeedLink[0].firstChild.nodeValue;
                                    var sName = oFeedName[0].firstChild.nodeValue;
                                    aHtml.push('<li><a href="#" onclick="myRss.getFeed(' + "'" + sLink + "'" + ');return false;">' + sName + '</a></li>')
                                } catch (er) {
                                    alert("解释xml数据时出错，请再刷新试试..");
                                }
                            }
                        }
                    });
                    aHtml.push('</ul>');
                    sHtml = aHtml.join("");
                    oInsertedPosition.append(sHtml);
                }
            });

        },

        fGetFeedEK: function (link, callback) {
            jQ("#dvContent").FeedEk({
                FeedUrl: link,
                MaxCount: 20
            }, callback);
        },
        fGet: function (link, encoding, callabck) {
            var that = this;
            if (sMode == "Flash") {
                encoding ? encoding : encoding = "utf-8";
                that.fRequest({
                    url: link + "?" + new Date().valueOf(),
                    charset: encoding,
                    call: function (oDom) {
                        if (oDom.code) {
                            var erMsg = oDom.code;
                            if (erMsg == "changeCharset") {
                                that.fGet(link, "gb2312", callabck);
                            } else if (erMsg == "ioError") {
                                alert("抱歉！似乎无法获取该feed。");
                            } else {
                                alert("error");
                            }
                        } else {

                            that.fShowContent(oDom, callabck);

                        }

                    }
                });
                
            } else {
                that.fGetFeedEK(link, callabck);
            }
            jQ(".note").removeClass("visible-xs").hide();
        },
        //以下是解释flash请求得到的Xml数据的内部逻辑函数
        fShowContent: function (oDom, callback) {
            var dvContent = jQ("#dvContent");
            var oRss = this.fGetRssObj(oDom);
            var oInfo = oRss.channel;
            var aItems = oRss.items;
            var aHtml = [];
            for (var i = 0; i < this.aInfo.length; i++) {
                var sTag = this.aInfo[i];

                if (typeof (sTag) != "string") {
                    sTag = sTag.name;

                    if (sTag == "image" && oInfo.image) {
                        aHtml.push(sTag + ":" + '<a href="' + oInfo.image.link + '" target="_blank"><img src="' + oInfo.image.url + '" title="' + oInfo.image.title + '"></a><br>');
                    }
                } else {

                    aHtml.push(sTag + ":" + oInfo[sTag] + "<br>");

                }
            }
            aHtml.push('<ul>');
            for (var i = 0; i < aItems.length; i++) {
                aHtml.push('<li><a href="' + aItems[i].link + '" target="_blank">' + aItems[i].title + '</a></li><p style="overflow:hidden;zoom:1">' + aItems[i].description.substring(0, 100) + '<a href="#">显示更多</a></p>')

            }
            aHtml.push('</ul>');
            dvContent.html(aHtml.join(""));
            if (callback) {
                callback(oInfo["title"]);
            }

        },
        fRequest: function (oData) {
            var that = this;
            oData.method = oData.method || "get";

            // 从对象池中获得一个请求对象
            var oReq = FlashRequest.getInstance();

            oReq.open(oData.method, oData.url, oData.charset || "utf-8");

            // 异步调用
            if (!oData.sync) {

                // 事件处理绑定
                oReq.onreadystatechange = _fCallback;
            }
            var aHead = oData.head || [];

            // 设置http头信息
            for (i = 0, l = aHead.length; i < l; i += 2) {
                oReq.setRequestHeader(aHead[i], aHead[i + 1]);
            }

            // 发送请求
            oReq.send(oData.method == 'post' ? oData.body : null);
            if (oData.sync) {

                // 同步立刻回调
                _fCallback();
            }

            function _fCallback(sState, sValue) {

                var discernUTF = new RegExp(/utf-8/i);
                var isUtf8 = discernUTF.test(sValue);

                if (sState == "complete") {
                    if (isUtf8 == false && oData.charset == "utf-8") {
                        oData.call({ 'code': 'changeCharset' });
                    }
                    else {
                        if (oData.call) {
                            try {
                                oResult = that.fGetXmlDom(sValue);
                            }
                            catch (e) {
                                oResult = sValue;
                            }
                            oData.call(oResult);
                        }
                    }
                }
                else if (sState == "httpStatus" && sValue == "202") {
                    oData.call({ 'code': 'error' });

                } else if (sState == "ioError") {
                    oData.call({ 'code': 'ioError' });

                }
            }
        },

        fGetXmlDom: function (sXML) {
            var r;
            //aaa.innerHTML = sXML;
            //alert(sXML);
            //var s = "XML解析错误，请关闭防火墙或者杀毒软件，然后重新登陆！";
            if (window.ActiveXObject) {
                r = this.fGetDomDocument();
                r.loadXML(sXML);
                if (r.parseError != 0) {
                    throw "parse xml error";
                }
            } else if (window.DOMParser) {
                r = new DOMParser().parseFromString(sXML, "text/xml");
                if (!r.documentElement || r.documentElement.tagName == "parsererror") {
                    throw "parse xml error";
                }
            } else {
                r = document.createElement('div');
                r.innerHTML = sXML;
            }
            return r;
        },

        fGetDomDocument: function () {
            var aTry = [
                function () { return new ActiveXObject('Msxml2.DOMDocument.6.0'); },
                function () { return new ActiveXObject('Msxml2.DOMDocument.3.0'); },
                function () { return document.implementation.createDocument("", "", null); },
                function () { return new ActiveXObject('Msxml2.DOMDocument.5.0'); },
                function () { return new ActiveXObject('Msxml2.DOMDocument.4.0'); },
                function () { return new ActiveXObject('Msxml2.DOMDocument'); },
                function () { return new ActiveXObject('MSXML.DOMDocument'); },
                function () { return new ActiveXObject('Microsoft.XMLDOM'); }
            ];
            for (var i = 0; i < aTry.length; i++) {
                try {
                    return aTry[i]();
                } catch (e) { }
            }
        },

        

        aInfo: [
            "lastBuildDate", "title", "description", {
                name: "image",
                items: ["url", "title", "link"]
            }, "link", "copyright"
        ],

        fGetRssObj: function (oDom) {
            var oRoot = oDom.documentElement.getElementsByTag ? oDom.documentElement.getElementsByTag("/rss")[0] : oDom.documentElement;

            var oInfo = this.fGetDom(oRoot, {
                name: "channel",
                items: this.aInfo

            });
            var aItems = this.fSelectNodes(oRoot, "channel/item");
            oInfo.items = [];
            for (var i = 0; i < aItems.length; i++) {
                var sDescription = this.fGetDom(aItems[i], "description").description;
                oInfo.items.push({
                    title: this.fGetDom(aItems[i], "title").title,
                    link: this.fGetDom(aItems[i], "link").link,
                    description: sDescription.replace(/<\/?[^>]+>/gi, ''),
                    content: sDescription
                });
            }
            return oInfo;
        },

        fSelectNodes: function (oDom, sSelector) {

            return "selectNodes" in oDom ? oDom.selectNodes(sSelector) : oDom.querySelectorAll(sSelector.replace("/", " "));

        },

        fGetDom: function (oDom, sTag) {
            var o = {};
            if (typeof (sTag) == "string") {
                var oTag = (this.fSelectNodes(oDom, sTag)[0] || {});
                o[sTag] = oTag.text || oTag.textContent || "";
            } else {
                var oTag = this.fSelectNodes(oDom, sTag.name);
                if (oTag[0]) {
                    o[sTag.name] = {};
                    for (var i = 0; i < sTag.items.length; i++) {
                        var t = (typeof (sTag.items[i]) == "string" ? sTag.items[i] : sTag.items[i].name);
                        o[sTag.name][t] = this.fGetDom(oTag[0], sTag.items[i])[t];
                    }
                }
            }
            return o;
        }
        
    };//getRss
    return {
        init: function (sInitMode) {
            init(sInitMode);
        },
        getFeed: function (link, encoding, callback) {
            jQ(window).scrollTop(0);
            getRss.fGet(link, encoding, callback);  
        },
        addFeed: function (sLink, sName, bForce) {
            LocalData.add(sLink, sName);
            getRss.fUpdateList("local", $userList, bForce);
        },
        getLocStor:function(sKey){
            return LocalData.get(sKey);
        },
        UIdrag: function (obj) {
            LocalData.UIdrag(obj);
        },
        UIdrop: function (ev) {
            LocalData.UIdrop(ev);
        },
        UIallowDrop: function (ev) {
            LocalData.UIallowDrop(ev);
        },
        UIdragEnd: function (ev) {
            LocalData.UIdragEnd(ev);
        }
    }
})(jQuery,window);//myrss
//FeedEk
(function ($) {
    $.fn.FeedEk = function (opt,callGetTitle) {
        var def = $.extend({
            FeedUrl: "http://rss.cnn.com/rss/edition.rss",
            MaxCount: 5,
            ShowHead: true,
            ShowDesc: true,
            ShowPubDate: false,
            DescCharacterLimit: 120,
            TitleLinkTarget: "_blank",
            showImg:true,
            showFormat:false
        }, opt);
        var userSet = {};
        userSet = myRss.getLocStor("UserSetting");
        def = $.extend(def,userSet);
        
        var id = $(this).attr("id");
        var i;
        var rElmImg = /<img[^>]*?\/?>/gi,   //get all img element
            rElmAttr1 = /(width|height){1}[^\"]*?\"\s?0[^\"]*?\"/gi, //0尺寸的img
            rElmAttr2 = /(align|width|height|style){1}[^\"]*?\"[^(0|\")?][^\"]*?\"/gi,  ////align、非0的尺寸
            rElmHtml = /(<[^>]*?>|\s\s)/gi, //HTML element
            rDelBR1 = /^(<br>[\s]*)+/gi,    //删除开头的转行
            rDelBR2 = /(<br>[\s]*)+/gi,     //删除重复的转行
            rDelBR3 = /<br>(\S{0,6})<br>/gi;//删除短转行


        $("#" + id).empty().append('<img src="image/loader.gif" />');
        $.ajax({
            url: "http://ajax.googleapis.com/ajax/services/feed/load?v=1.0&num=" + def.MaxCount + "&output=json&q=" + encodeURIComponent(def.FeedUrl) + "&hl=en&callback=?",
            dataType: "json",
            error: function (data) {
                alert('Error:The feed can not be displayed.' + data);
            },
            success: function (data) {
                $("#" + id).empty();
                if (data.responseStatus == 200) {
                    var oFeed = data.responseData.feed;
                    var sHtml = "";
                    var aHtml = [];
                    var bShowPubDate = def.ShowPubDate; //in fact is string
                    var bShowDesc = def.ShowDesc;       //in fact is string
                    var iLimit = def.DescCharacterLimit;
                    if (def.ShowHead=="true" || def.ShowHead==true) {
                        if (oFeed.entries[0]) {
                            var sDate = func1.ConvToLocalTime(oFeed.entries[0].publishedDate);
                        }
                        aHtml.push('<div class="listHead">最后更新：' + sDate + '<br/>');
                        aHtml.push('订阅链接：' + oFeed.feedUrl + '&nbsp;&nbsp;<abbr title="添加到您的列表" unselectable="on" class="glyphicon glyphicon-plus pointer"></abbr><br/>');
                        aHtml.push('标题：<a href="' + oFeed.link + '" target="_blank">' + oFeed.title + '</a><br/>');
                        aHtml.push("简介：" + oFeed.description + '<br/></div>');
                    }
                    $.each(oFeed.entries, function (e, item) {
                        aHtml.push('<div class="itemOne">');
                        aHtml.push('<div unselectable="on" class="itemIcon glyphicon glyphicon-chevron-down"></div>');
                        aHtml.push('<div class="itemTitle"><li><a href="' + item.link + '" target="' + def.TitleLinkTarget + '" >' + item.title + "</a></li></div>");
                        if (bShowPubDate=="true" || bShowPubDate == true) {
                            var sDate = func1.ConvToLocalTime(item.publishedDate);
                            aHtml.push('<div class="itemDate">' + sDate + "</div>");
                        }
                        if (bShowDesc!="false" || bShowDesc == true) {
                            
                            if(typeof bShowDesc =="string"){
                                if(bShowDesc=="true"){
                                    iLimit = 0;
                                }else{
                                    iLimit = Number(bShowDesc);
                                }
                            }

                            var sContent = item.content;
                            var aImg,sImg;                           
                            aImg = sContent.match(rElmImg);  //get all img element
                            if(def.showFormat!="true"){
                                sContent = sContent.replace(rElmHtml, "<br>").replace(rDelBR1, "").replace(rDelBR3, "$1").replace(rDelBR2, "<br>"); 
                                
                            }
                            aHtml.push('<div class="itemContent">');
                            if (iLimit > 0 && sContent.length > iLimit) {
                                aHtml.push(sContent.substr(0, iLimit));
                                aHtml.push('<span class="iHide">&nbsp;');
                                if (sContent.length > iLimit * 3) {
                                    aHtml.push(sContent.substr(iLimit, iLimit * 2));
                                } else {
                                    aHtml.push(sContent.substr(iLimit));
                                }
                                aHtml.push('</span>...');
                            } else {
                                aHtml.push(sContent);
                            }
                            aHtml.push('</div>');
                            if (showImg != "false" && aImg != null) {
                                aHtml.push('<div class="iHide itemImg">');
                                for (var i = 0; (i < aImg.length) && (i<3); i++) {
                                    if (aImg[i].match(rElmAttr1) == null) {       //如果有0尺寸的就不显示
                                        sImg = aImg[i].replace(rElmAttr2, "");    //去除align、非0的尺寸
                                        sImg = sImg.replace(/src/gi, "delayLoad");
                                        aHtml.push(sImg);
                                    }
                                }
                                aHtml.push("</div>");
                            }
                        }
                        aHtml.push('</div>');
                    });//each oFeed.entries
                    sHtml = aHtml.join("");
                    $("#" + id).append('<ul class="feedEkList">' + sHtml + "</ul>");
                    if (callGetTitle) {
                        callGetTitle(oFeed.title);
                    }
                } else {
                    var sInfo = data.responseDetails;
                    alert('Error:'+sInfo);
                }
                //success event:
                $(".itemOne").click(function () {
                    //$(".itemOne .iShowInline").removeClass("iShowInline").addClass("iHide");
                    var oJqImg = $(this).find("img");
                    var sImgLink;
                    $.each(oJqImg, function (i, oImg) {
                        sImgLink = $(oImg).attr("delayLoad");
                        $(oImg).attr("src", sImgLink);
                    });
                    var oJqTitle = $(this).find("li");
                    if (oJqTitle.hasClass("fontLarger")) {
                        oJqTitle.removeClass("fontLarger");
                        $(this).find(".itemIcon").removeClass("glyphicon-chevron-up").addClass("glyphicon-chevron-down");
                    } else {
                        oJqTitle.addClass("fontLarger");
                        $(this).find(".itemIcon").removeClass("glyphicon-chevron-down").addClass("glyphicon-chevron-up");
                    }
                    
                    $(this).find("span").fadeToggle("fast");
                    $(this).find(".itemImg").slideToggle("fast");

                });
                $(".itemOne").mouseenter(function () {
                    $(this).addClass("itemOneBorder");
                    //$(this).find("itemIcon").removeClass("glyphicon-chevron-up");
                    $(this).find(".itemIcon").fadeIn("fast");
                });
                $(".itemOne").mouseleave(function () {
                    var jQthat = $(this);                  
                    //setTimeout(function () {
                    //}, 20);
                    if (!(jQthat.find("li").hasClass("fontLarger"))) {
                        jQthat.removeClass("itemOneBorder");
                        jQthat.find(".itemIcon").fadeOut("fast");
                    }
                });
                $(".glyphicon-plus").click(function () {
                    if ((typeof myRss) !== undefined) {     //rss.js
                        myRss.addFeed(oFeed.feedUrl, oFeed.title, true);
                    }
                });
            }//success
        });//ajax
    };
    var func1 = {
        ConvToLocalTime: function (sDate,sStyle) {
            var i = new Date(sDate);           
            if (sStyle == "date") { return i.toLocaleDateString(); }
            else if (sStyle == "time") { return i.toLocaleTimeString(); }
            else { return i.toLocaleString(); }
        }
    }
})(jQuery);
